<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        let money = 100
        let kaishi = true
        while (kaishi) {
            let nth = prompt('请根据功能输入对应数字\r1.取钱\r2.存钱\r3.查看余额\r4.退出')
            switch (nth) {
                case '1':
                    let no = +prompt('请输入取款金额')

                    if (no <= money) {
                        money -= no
                        alert('取了：' + no + '还剩：' + money)
                    } else {
                        alert('金额不足')
                    }
                    break;
                case '2':
                    let ins = +prompt('请输入存款金额')
                    if (ins > 0) {
                        money += ins
                        alert('存了：' + ins + '金额为：' + money)
                    } else {
                        alert('金额无效')
                    }
                    break;
                case '3':
                    alert('金额：' + money)
                    break;
                case '4':
                    kaishi = false
                    break;
                default:
                    alert('输入无效')
            }
        }

    </script>
</body>

</html>